home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 11
/
Cream of the Crop 11-1.iso
/
program
/
swmp141.zip
/
C.DOC
< prev
next >
Wrap
Text File
|
1995-12-12
|
6KB
|
145 lines
┌────────────────────────────────────────────────────────────────────────────┐
│ Module Player V1.41 (c) 1994,1995 by Lord Excess of Sound Wizards Int. │
└────────────────────────────────────────────────────────────────────────────┘
USING THE SWMP DRIVERS WITH 'BORLAND C'
───────────────────────────────────────
First of all you have to unzip the files of the included
archive C_SDK.ZIP into an existing directory.
The files you need in any case are:
MODPLAY.INC : interface to drivers
MOD_DRV.OBJ : all sound drivers
The rest are example files, which can be important to
understand things better. Now you have to perform two steps to
use all mod-routines:
1. Add the following expression to your source code:
#include "modplay.inc"
2. For a successfull link of the drivers you best open a
project file, else you have to study the syntax of your
linker... After that add the file "mod_drv.obj" and of
course all of your source files.
At program start you have to initialize one of the drivers
using the following subroutine:
┌──INIT DRIVER─────────────────────────────────────────────────────────────────
│ void MOD_Init(unsigned int Driver, unsigned int Port,
│ unsigned char IRQ, unsigned char DMA)
│ -> Select and initialize driver for sound output
│
│ Driver = Detection (0) : Port = 0
│ IRQ = 0
│ DMA = 0
│
│ = SoundBlaster (1) : Port = SB base address (x220..)
│ IRQ = SB IRQ#
│ DMA = 1 (always)
│
│ = SoundBlaster_Pro (2) : Port = SBP base address
│ IRQ = SBP IRQ#
│ DMA = SBP DMA channel
│
│ = Gravis_UltraSound (3) : Port = GUS base address
│ IRQ = GF1 IRQ#
│ DMA = MIDI IRQ# !!
└
A very powerful hardware detection is able to detect any
supported soundcard with all required settings. So in general
the easiest way to init the drivers is:
MOD_Init(Detection,0,0,0);
If all fails you can override detection and select one of the
drivers by yourself, but in this case you have to know (or ask
for) the settings of an installed soundcard.
If you want to know if initialisation was successfull, have a
look at the variable (unsigned int) Soundcard, which will
contain the output device:
0: no sound available
1: SoundBlaster [ 22.2 kHz mono ]
2: SoundBlaster Pro [ 21.7 kHz stereo ]
3: Gravis UltraSound [ 44.1 kHz +stereo+ ]
You do not have to handle this variable. You can also call the
driver's subfunctions even if no soundcard was detected,
nothing will happen in this case.
At program end the unit selfrestores any altered interrupt
vectors etc.
The following functions are now available:
(Note: The first two functions are enough to playback a mod !!!)
┌──LOAD MODULE─────────────────────────────────────────────────────────────────
│ void Mod_Load(char far *File_Name)
│ -> Stops possible sound output, loads module file into memory,
│ but does not start playing. If successfull the variable
│ (unsigned int) Channels will contain the number of channels,
│ else zero.
└
┌──PLAY MODULE─────────────────────────────────────────────────────────────────
│ void Mod_Play(unsigned int Looping)
│ -> Starts playing previously loaded song. If looping is zero,
│ song is played only once, else continuously.
└
┌──STOP MODULE─────────────────────────────────────────────────────────────────
│ void Mod_Stop(void)
│ -> Stops sound output at once.
└
┌──MAIN VOLUME─────────────────────────────────────────────────────────────────
│ void Mod_Volume(unsigned char Volume)
│ -> Changes the driver's main volume setting. Valid values are
│ between 0 (lowest) and 64 (loudest).
└
┌──STATUS──────────────────────────────────────────────────────────────────────
│ unsigned int Mod_Status(void)
│ -> Returns 1 if sound is being played, else 0.
└
┌──GET POSITION────────────────────────────────────────────────────────────────
│ unsigned int Mod_Position(void)
│ -> Returns 256*PatternNumber+LineNumber. Can be useful to
│ syncronize a special graphic effect to the sound.
└
┌──JUMP BACK───────────────────────────────────────────────────────────────────
│ void Mod_Rewind(void)
│ -> Decreases current songposition. No effect in first pattern.
└
┌──JUMP FORWARD────────────────────────────────────────────────────────────────
│ void Mod_Forward(void)
│ -> Increases current songposition. No effect in last pattern.
└
┌──PEAKS───────────────────────────────────────────────────────────────────────
│ void Mod_Peak(void)
│ -> Updates the array Peaks by copying the driver's volume
│ setting (0..64) of each channel. The number of channels
│ can be found in the variable Channels (WORD) and is either
│ four, six or eight.
└
In general it remains to be said that you can do as much error
checking as you like, but it is not necessary. In a demo or
intro for example you do not care if there is sound available
to the grafix you produce on the screen (in most cases). But in
a player it is evident that you need to have any sounddevice at
all to output the sound! The best way is to take a look at the
example programs. Have a lot of fun!
Lord Excess in Dezember '95